home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6590 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Keyboard buffer problems...please help!
  5. Date: 18 Feb 1996 09:22 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <18FEB199609221151@erich.triumf.ca>
  9. References: <3126B507.4052@canna.ucsd.edu>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <3126B507.4052@canna.ucsd.edu>, "Eric C. Liebl" <ecl@canna.ucsd.edu> writes...
  14. >I am looking for a C command that will flush the keyboard buffer before 
  15. >it is read.  I am using Borland C/C++ 4.0 to compile my program.  
  16. >Basically, I have a do while loop with getch() initiated when kbhit is 
  17. >true...when an appropriate key is hit I update graphics, etc. in my 
  18. >program.  However, if a user holds the key down the key data fills the 
  19. >keyboard buffer and I get an annoying beep and too many "moves" get 
  20. >stored up in advance.
  21.  
  22. You might do better asking this in an MS-DOS newsgroup, like
  23. comp.os.msdos.programmer, since the C language doesn't provide anything to help
  24. you (the results of fflush() are undefined for input streams)
  25.  
  26. There is a byte somewhere that indicates when a key is pressed or released,
  27. which may be useful (I don't have the address handy...)
  28.  
  29. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  30. Internet: bennett@triumf.ca         | of one another only when one can be
  31. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  32. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  33. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.